/*
 * TTCPWriter.cpp
 *
 *  Created on: 06.03.2012
 *      Author: caffeine
 */

#include "CTCPWriter.h"
#include <lampe/exception/Base.h>

namespace lampe{
namespace stream{
namespace tcp{

u32 CTCPWriter::write(void* buffer, u32 size){
	if (!signal)
		return do_send(sock,buffer,size);
	int readed=do_send(sock,buffer,size);
	if (readed!=(int)size)
		GEN_ERROR("Can't send data. Size of sended min of data size!");
	return readed;
}

CTCPWriter::CTCPWriter(SOCKET s,bool sing){
	sock=s;
	signal=sing;
}

CTCPWriter::~CTCPWriter(){
}

}//namespace tcp
}//namespace stream
}//namespace lampe
